DateTimeEditors for WinRT
Specifying the Date and Time

You can specify the time and date of a C1DateTimePicker control by setting the C1DateTimePicker.DateTime property using code.

Try to avoid setting the C1DateTimePicker.DateTime property in XAML. Parsing these values from strings is culture specific. If you set a value with your current culture and a user is using different culture, the user can get XamlParseException when loading your site. The best practice is to set these values from code or via data binding.

In Code

Complete the following steps:

  1. Open the MainPage.xaml.cs page.
  1. Place the following code beneath the C1DateTimePicker_Loaded event:
Visual Basic
Copy Code
C1DateTimePicker1.DateTime = New DateTime(2010, 1, 17, 11, 04, 0)

C#
Copy Code
c1DateTimePicker1.DateTime = new DateTime(2010, 1, 17, 11, 04, 0);
  1. Run the project and observe that the C1DateTimePicker control shows the date and time as 01/17/2010 11:04:00 AM.

This Topic Illustrates the Following:

The result of this topic resembles the following image:

See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback